import proxy.DefaultInvocation;
import supper.BaseMapper;
import supper.UserMapper;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class AppMain {


    public static void main(String[] args) throws Exception {
        UserMapper userMapper = new UserMapper();
        // InvocationHandler的实现类
        InvocationHandler invocationHandler = new DefaultInvocation(userMapper);
        // 要加载代理对象类的类加载器
       // ClassLoader classLoader = BaseMapper.class.getClassLoader();
        // 要被代理的接口
       // Class<?>[] interfaces = new Class<?>[]{BaseMapper.class};
        //三个参数  参数1,当前代理类 参数2:当前代理类的接口 参数3: 句柄函数
        BaseMapper proxyMapper = (BaseMapper) Proxy.newProxyInstance(UserMapper.class.getClassLoader(), UserMapper.class.getInterfaces(), invocationHandler);

        proxyMapper.insert();

    }
}